//
//  CJUtils.h
//  DatangLife
//
//  Created by 娜 on 2018/4/23.
//  Copyright © 2018年 DatangLife. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^CJRefreshAndLoadMoreHandle)(void);

@interface CJUtils : NSObject

/**
 开始下拉刷新
 */
+ (void)beginPullRefreshForScrollView:(UIScrollView *)scrollerView;

/**
 判断头部是否在刷新
 */
+ (BOOL)headerIsRefreshForScrollerView:(UIScrollView *)scrollerView;

/**
 判断尾部是否在刷新
 */
+ (BOOL)footerIsRefreshForScrollerView:(UIScrollView *)scrollerView;

/**
 提示没有更多数据的情况
 */
+ (void)noticeNoMoreDataForScrollerView:(UIScrollView *)scrollerView;

/**
 重置footer
 */
+ (void)resetNoMoreDataForScrollerView:(UIScrollView *)scrollerView;

/**
 停止下拉刷新
 */
+ (void)endRefreshForScrollerView:(UIScrollView *)scrollerView;

/**
 停止上拉加载
 */
+ (void)endLoadMoreForScrollerView:(UIScrollView *)scrollerView;

/**
 隐藏footer
 */
+ (void)hiddenFooterForScrollerView:(UIScrollView *)scrollerView;

/**
 隐藏header
 */
+ (void)hiddenHeaderForScrollerView:(UIScrollView *)scrollerView;


/**
 上拉加载
 */
+ (void)addLoadMoreForScrollerView:(UIScrollView *)scrollerView loadMoreCallBack:(CJRefreshAndLoadMoreHandle)loadMoreCallBlackBlock;

/**
 下拉加载
 */
+ (void)addPullRefreshForScrollerView:(UIScrollView *)scrollerView pullRefreshCallBack:(CJRefreshAndLoadMoreHandle)pullRefreshCallBackBlock;

/**
 *  公共富文本
 */
+ (NSAttributedString *)attStringWithString:(NSString *)string keyWord:(NSString *)keyWord;

+ (NSAttributedString *)attStringWithString:(NSString *)string
                                    keyWord:(NSString *)keyWord
                                       font:(UIFont *)font
                           highlightedColor:(UIColor *)highlightedcolor
                                  textColor:(UIColor *)textColor;

+ (NSAttributedString *)attStringWithString:(NSString *)string
                                    keyWord:(NSString *)keyWord
                                       font:(UIFont *)font
                           highlightedColor:(UIColor *)highlightedcolor
                                  textColor:(UIColor *)textColor
                                  lineSpace:(CGFloat)lineSpace;

+ (NSString *)validString:(NSString *)string;

@end
